package ar.edu.um.isa.mb.ws;

import java.util.List;

import javax.jws.WebService;

import ar.edu.um.isa.common.ServiceLocator;
import ar.edu.um.isa.facade.MicrobloggingFacade;
import ar.edu.um.isa.model.Publication;
import ar.edu.um.isa.model.Publisher;

@WebService(serviceName="MicrobloggingWebService")
public class MicrobloggingWebService {

	public void publish(Publication publication){
		try {
			MicrobloggingFacade microbloggingFacade = (MicrobloggingFacade) ServiceLocator.getInstance().getService("microbloggingFacade");
			microbloggingFacade.publish(publication);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public List<Publication> findPublicationByPublisher(Publisher publisher){
		try {
			MicrobloggingFacade microbloggingFacade = (MicrobloggingFacade) ServiceLocator.getInstance().getService("microbloggingFacade");
			return microbloggingFacade.findPublicationByPublisher(publisher);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}

}
